package sol.leetcode;

import java.util.HashMap;
import java.util.Map;

/**
 * Contains Duplicate
 * Created by lkk on 2016/8/28.
 */
public class Issue217 {
    public static boolean containsDuplicate(int[] nums) {
        Map<Integer, Integer> count = new HashMap<Integer, Integer>();
        for (int num : nums) {
            if (count.containsKey(num))
                return true;
            count.put(num, 1);
        }
        return false;
    }

    public static void main(String[] args) {
        int[] nums = {1, 2, 3, 4, 5};
        System.out.println(containsDuplicate(nums));
    }
}
